/**
 * Created by wilson on 3/14/15.
 */
(function () {
    angular.module('app')
        .factory('mapService', mapService);

    mapService.$inject = ['$window'];
    function mapService($window) {
        var MS = {
            init: init,
            clearOverlay: clearOverlay
        };

        function init(id, x, y, zoomLv) {
            var map = new BMap.Map(id);
            var point = new BMap.Point(x, y);
            map.centerAndZoom(point, zoomLv);
            return map;
        }

        function clearOverlay(map) {
            map.clearOverlays();
        }

        return MS;
    }
})();